package com.buanalintas.sandals.pos.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlTransient;

@Entity
@Table(name = "pos_master_supplier")
//@NamedQueries({
//    @NamedQuery(name = "PosMasterSupplier.findAll", query = "SELECT t FROM PosMasterSupplier t"),
//    @NamedQuery(name = "PosMasterSupplier.findBySync", query = "SELECT t FROM PosMasterSupplier t WHERE t.sync = :sync"),
//    @NamedQuery(name = "PosMasterSupplier.findBySupplierId", query = "SELECT t FROM PosMasterSupplier t WHERE t.supplierId = :supplierId"),
//    @NamedQuery(name = "PosMasterSupplier.findBySupplierCode", query = "SELECT t FROM PosMasterSupplier t WHERE t.supplierCode = :supplierCode"),
//    @NamedQuery(name = "PosMasterSupplier.findBySupplierName", query = "SELECT t FROM PosMasterSupplier t WHERE t.supplierName = :supplierName"),
//    @NamedQuery(name = "PosMasterSupplier.findBySupplierAddress", query = "SELECT t FROM PosMasterSupplier t WHERE t.supplierAddress = :supplierAddress"),
//    @NamedQuery(name = "PosMasterSupplier.findBySupplierPhone", query = "SELECT t FROM PosMasterSupplier t WHERE t.supplierPhone = :supplierPhone"),
//    @NamedQuery(name = "PosMasterSupplier.findBySupplierContact", query = "SELECT t FROM PosMasterSupplier t WHERE t.supplierContact = :supplierContact")})
public class PosMasterSupplier implements Serializable {
    @OneToMany(mappedBy = "supplierModelSupplierId")
    private Collection<PosMasterSupplierModel> posMasterSupplierModelCollection;

    private static final long serialVersionUID = 1L;
    @Column(name = "sync")
    private String sync;
    @Id
    @Basic(optional = false)
    @Column(name = "supplier_id")
    private Integer supplierId;
    @Column(name = "supplier_code")
    private String supplierCode;
    @Column(name = "supplier_name")
    private String supplierName;
    @Column(name = "supplier_address")
    private String supplierAddress;
    @Column(name = "supplier_phone")
    private String supplierPhone;
    @Column(name = "supplier_contact")
    private String supplierContact;

    public PosMasterSupplier() {
    }

    public PosMasterSupplier(Integer supplierId) {
        this.supplierId = supplierId;
    }

    public String getSync() {
        return sync;
    }

    public void setSync(String sync) {
        this.sync = sync;
    }

    public String getSupplierAddress() {
        return supplierAddress;
    }

    public void setSupplierAddress(String supplierAddress) {
        this.supplierAddress = supplierAddress;
    }

    public String getSupplierCode() {
        return supplierCode;
    }

    public void setSupplierCode(String supplierCode) {
        this.supplierCode = supplierCode;
    }

    public String getSupplierContact() {
        return supplierContact;
    }

    public void setSupplierContact(String supplierContact) {
        this.supplierContact = supplierContact;
    }

    public Integer getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(Integer supplierId) {
        this.supplierId = supplierId;
    }

    public String getSupplierName() {
        return supplierName;
    }

    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }

    public String getSupplierPhone() {
        return supplierPhone;
    }

    public void setSupplierPhone(String supplierPhone) {
        this.supplierPhone = supplierPhone;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (supplierId != null ? supplierId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof PosMasterSupplier)) {
            return false;
        }
        PosMasterSupplier other = (PosMasterSupplier) object;
        if ((this.supplierId == null && other.supplierId != null) || (this.supplierId != null && !this.supplierId.equals(other.supplierId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        // return "com.buanalintas.sandals.pos.entities.PosMasterSupplier[supplierId=" + supplierId + "]";
        return supplierName + " - " + supplierAddress;
    }

    @XmlTransient
    public Collection<PosMasterSupplierModel> getPosMasterSupplierModelCollection() {
        return posMasterSupplierModelCollection;
    }

    public void setPosMasterSupplierModelCollection(Collection<PosMasterSupplierModel> posMasterSupplierModelCollection) {
        this.posMasterSupplierModelCollection = posMasterSupplierModelCollection;
    }
}
